import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ViteCompression from 'vite-plugin-compression'
import { resolve } from 'path'
import { Plugin as importToCDN } from 'vite-plugin-cdn-import'
// https://vitejs.dev/config/
export default defineConfig({
  server:{
    port:80,

  },
  base:'./',
  plugins: [vue(),
    ViteCompression({
      algorithm: 'gzip',
      threshold: 10240,
    })
    ,
    importToCDN({
      modules:[
        {
          name: 'vue',
          var: 'Vue',
          path: `https://cdn.bootcdn.net/ajax/libs/vue/3.3.4/vue.global.prod.min.js`,
          
        },
        {
          name: 'vue-demi',
          var: 'VueDemi',
          path: `https://cdn.bootcdn.net/ajax/libs/vue-demi/0.14.6/index.iife.min.js`,
        },
        {
          name: 'vue-router',
          var: 'VueRouter',
          path: `https://cdn.bootcdn.net/ajax/libs/vue-router/4.2.4/vue-router.global.prod.min.js`,
        },
        {
          name: 'element-plus',
          var: 'ElementPlus',
          path: 'https://cdn.bootcdn.net/ajax/libs/element-plus/2.3.12/index.full.min.js',
          css: 'https://cdn.bootcdn.net/ajax/libs/element-plus/2.3.12/index.min.css'
        },
      ]
    })
  ],
  resolve:{
    alias:{
      "@":resolve(__dirname,'./src'),
    }
  }
})
